package kg.aibek.preuler1;

import java.util.ArrayList;
import java.util.List;

public class Util {
	public static List<String> getPermutation(List<Integer> nList) {
		List<String> ssList = new ArrayList<String>();
		if (nList.size() == 0) {
			ssList.add("");
			return ssList;
		}

		for (Integer i : nList) {
			String s = i + "";
			List<Integer> nnList = new ArrayList<Integer>();
			nnList.addAll(nList);
			nnList.remove(i);
			List<String> sList = getPermutation(nnList);
			for (String str : sList) {
				ssList.add(s + str);
			}
		}

		return ssList;
	}

	public static boolean isPrime(long number) {
		if (number <= 1) {
			return false;
		}
		for (long i = 2; i * i <= number; i++) {
			if (number % i == 0) {
				return false;
			}
		}
		return true;
	}
}
